<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            box-sizing: border-box;
        }

        main{
            position: absolute;
            left: 50%;
            top: 50%;
            margin-top: -200px;
            margin-left: -200px;

            border-style: solid;
            border-width: 2px;

            width: 400px;
            height: 400px;
        }

        div{
            position: absolute;
            left: 50%;
            top: 50%;
            border-style: solid;
            border-width: 2px;
            width: 200px;
            height: 200px;
            transition: 1s;
        }

        div:first-child{
            background-color: aqua; 
            transform: translate(-50%,-50%) perspective(500px) rotateY(45deg) ;
        }

        div:nth-child(2){
            background-color:chocolate;
            transform: translate(-50%,-50%) perspective(500px) rotateY(45deg) ;
        }

        main:hover div:nth-child(2){
            transform: perspective(900px) rotateY(45deg) translate3d(100px,0,50px);
        }

    </style>
</head>

<body>
    <main>
        <div></div>
        <div></div>
    </main>

</body>

</html>